<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // ES5中存在trim方法，用来清除字符串两侧的空白字符
        // ES10中trimStart和trimEnd用来清除指定字符左侧或右侧的空白字符
        let str = '      hello     ';

        console.log(str);//      hello     ；
        console.log(str.trim());//hello;
        console.log(str.trimStart());//hello     ;
        console.log(str.trimEnd());//      hello;
    </script>
</body>
</html>